class Task33:
    def run(self, array):
        if len(array) is 0:
            return False
        return self.run_inner(array, 0, len(array))

    def run_inner(self, array, start_index, end_index):
        # start_index: inclusive
        # end_index: exclusive
        if end_index <= start_index + 1:
            return True

        root = array[end_index - 1]
        i = start_index
        while i < end_index and array[i] < root:
            i += 1

        is_all_big_after_i = True
        for j in range(i, end_index - 1):
            if array[j] < root:
                is_all_big_after_i = False
                break

        if not is_all_big_after_i:
            return False
        else:
            return self.run_inner(array, start_index, i) and self.run_inner(array, i, end_index - 1)
